package com.study.test.transactionaltest;

import com.study.ju.service.transactionaltest.TestAService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * https://blog.csdn.net/yangchangyong0/article/details/51960143
 * Created by tao on 2018/8/4.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:/spring/spring-service.xml"})
public class transactionaltest {
    @Autowired
    private TestAService testAService;
    @Test
    public void insetTes() {
        testAService.insetATest();
    }

    /**
     * 外部有try Catch时候，内部异常
     */
    @Test
    public void insetATestNoExceptionTryCatchtestBInsertExceptionAndNoTryCatchTest() {
        testAService.insetATestNoExceptionTryCatchtestBInsertExceptionAndNoTryCatch();
    }


}
